Note: There are often multiple ways to answer each question.
Create a vector of integers from -5 to 10 (inclusive) and assign it to the variable x
.
Create a vector which consists of the first 10 multiples of 3 (i.e. 3, 6, …, 30) and assign it to the variable y
.
What is the result of x + y
? Why does R return this result?
What is the result of z <- c(1, 2, "3")
? Why does R return this result?
Create the following list:
person <- list(name = "John Doe",
age = 26,
classes = c("ENG", "MAT", "SCI", "SPA", "MUS"))
What is the result of person$classes[2]
? Why does R return this result?
What code can I use to find out how many classes John Doe took?
Load the vehicles
dataset that we used in class. How many rows and columns are there in this dataset? What are the column names?
What is the highest hwy
value?
How many of each value are there in the cyl
column?
What is the mean, median and standard deviation of the cty
column?